package com.smartleanx.module.hrm.controller.admin.xxljob;


import cn.hutool.core.collection.CollUtil;
import com.smartleanx.framework.tenant.core.job.TenantJob;
import com.smartleanx.module.hrm.dal.dataobject.employee.EmployeeDO;
import com.smartleanx.module.hrm.service.employee.EmployeeService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 员工描任务
 *
 */
@Slf4j
@RestController
@RequestMapping("/hrm/xxJob")
public class EmployeeScanJobController {

    @Resource
    private EmployeeService employeeService;


    @PostMapping("/startScanEmp")
    public void scanEmployeeStateJob() {
        log.info("员工状态扫描任务开始====================");
        List<EmployeeDO> allEmployee = employeeService.getAllEmployee();
        if (CollUtil.isEmpty(allEmployee)) {
            return;
        }
        employeeService.scanEmployeeState();
        log.info("员工状态扫描任务结束====================");
    }

}
